<?php defined('NABU') || exit ?>

<h1>Artículos envíados</h1>

<?php require_once 'views/layouts/messages.php' ?>

<?php if (!empty($articles)): ?>
  <table>
    <tr>
      <td>Título</td>
      <td>Autor</td>
      <td></td>
      <td></td>
      <td></td>
    </tr>
    <?php foreach($articles as $article): ?>
      <tr>
        <td><?= $article['title'] ?></td>
        <td><a href="<?= NABU_ROUTES['profile'] . '&user=' . urlencode($article['author']) ?>" target="_blank"><?= $article['author'] ?></a></td>
        <td><button><a href="<?= NABU_ROUTES['edit_article'] . '&slug=' . $article['slug'] ?>">Editar</a></button></td>
        <td><button><a href="<?= NABU_ROUTES['delete_article'] . '&slug=' . $article['slug'] ?>">Eliminar</a></button></td>
        <td><button><a href="<?= NABU_ROUTES['authorize_article'] . '&slug=' . $article['slug'] ?>">Publicar</a></button></td>
      </tr>
    <?php endforeach ?>
  </table>
<?php endif ?>
